{extend name="personal/index" /}

  {block name="center"}
  <link href="static/css/password/common.css" rel="stylesheet" />
  <link href="static/css/password/safety.css" rel="stylesheet" />
  <link href="static/css/password/ui-dialog.css" rel="stylesheet" />



    <div class="personal-main userInfo fr" style="width:780px">
     <!-- 个人资料 start -->
     <div class="personal-module">
      <div class="ps-md-hd clearfix">
       <h6 class="ps-md-hd-tit fl">个人资料</h6>
      </div>
      <div class="ps-md-bd">
       <!-- 基本资料 start -->
       <div class="ui-tab">
        <div class="ui-tab-head">
         <div class="ui-tab-ctrl fl">
          <a href="indexPersonalZiliaoIndex" class="ui-tab-btn">基本资料</a>
          <a href="indexPersonalZiliaoPhoto" class="ui-tab-btn">修改头像</a>
          <a href="indexPersonalZiliaoPassword" class="ui-tab-btn ui-tab-cur">修改密码</a>
          <a href="indexPersonalZiliaoMibao" class="ui-tab-btn ">密保问题</a>
         </div>
        </div>

     <!-- 修改登录密码 第一步 start -->
     <div class="personal-module">
      <div class="ps-md-hd clearfix">
       <h6 class="ps-md-hd-tit fl">修改登录密码</h6>
      </div>
      <div class="ps-md-bd">
       <div class="safety-form clearfix">
        <form id="form" action="indexPersonalZiliaoChangepassword" method="post" name="setLoginPasswordForm" onsubmit="return checkForm()" class="J-setLoginPasswordForm" novalidate="novalidate">
         <input type="hidden" name="uniq" id="uniq" value="{$userList['pwd']}" />
         <div class="safety-form-row clearfix">
          <div class="safety-form-label fl">
           当前密码：
          </div>
          <div class="safety-form-span fl">
           <input type="password" name="pwd" id="oldPassword" onblur="checkOldpass()" class="input safety-form-email fl J-oldPassword" />
           <p class="form-error fl"></p>
          </div>
         </div>
         <div class="safety-form-row clearfix">
          <div class="safety-form-label fl">
           新密码：
          </div>
          <div class="safety-form-span fl">
           <input type="password" name="newPwd" id="newPassword" onblur="checkPass()"  class="input safety-form-email fl J-password" data-element=".J-oldPassword" />
           <p class="form-error fl"></p>
           <div class="safety-form-passBox clearfix" id="pwdStrong">
             密码强度：
            <span class="safety-status-view" id="span"><em class="safety-status-span"></em><em></em><em></em></span><span>(弱)</span>
           </div>
          </div>
         </div>
         <div class="safety-form-row clearfix">
          <div class="safety-form-label fl">
           确认密码：
          </div>
          <div class="safety-form-span fl">
           <input type="password" name="confirmPassword" id="confirmPassword" onblur="checkRepass()"  class="input safety-form-email fl J-confirmPassword" />
           <p class="form-error fl"></p>
          </div>
         </div>
         <div class="safety-form-row clearfix">
          <div class="safety-form-label fl">
           &nbsp;
          </div>
          <div class="safety-form-span fl">
           <span class="button-light-medium submitBtn">确定<button type="submit"></button></span>
           <a href="indexPersonalZiliaoZhaopassword" style="color:red">&nbsp&nbsp忘记密码?</a>
          </div>
         </div>
        </form>
       </div>

      </div>
     </div>
     <!-- 修改登录密码 第一步 end -->

    </div>
    </div>
     <!-- 个人资料 end -->
    </div>
   </div>

  <script>
  
      $('#newPassword').keyup(function(){
          if($(this).val().match(/^[0-9]*$/) || $(this).val().match(/^[A-Za-z]+$/)){
              $('#span em').eq(1).removeClass('safety-status-span');
              $('#span em').eq(2).removeClass('safety-status-span');
              $('#span').next('span').text("(弱)");
          }

          if($(this).val().match(/^[a-zA-Z]\w{5,}$/)){
              $('#span em').eq(1).addClass('safety-status-span');
              $('#span em').eq(2).removeClass('safety-status-span');
              $('#span').next('span').text("(中)");
          }

          if($(this).val().match(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$/)){
              $('#span em').eq(2).addClass('safety-status-span');
              $('#span').next('span').text("(强)");
          }
        
      })


      function checkPass(){
            if ($('#newPassword').val().match(/^[a-zA-Z]\w{5,17}$/)==null ) {
                $('#newPassword').next('p').html("密码须以字母开头,长度在6~18之间");
                return false;
            }else{
                $('#newPassword').next('p').html("");
                return true;
            }
        }

      function checkRepass(){
          if($('#newPassword').val() !== $('#confirmPassword').val()){
              $('#confirmPassword').next('p').html("两次密码不一致!!!");
              return false;
          }else{
            $('#confirmPassword').next('p').html("");
            return true;
          }
        }


      function checkOldpass(){
            if ($('#oldPassword').val() !== $('#uniq').val()) {
                $('#oldPassword').next('p').html("* 密码不正确");
                return false;
            }else{
                $('#oldPassword').next('p').html("");
                return true;
            }
        }



      function checkForm(){
            return checkPass() && checkRepass()&&checkOldpass();
        }







  </script>



  {/block}